//
//  LTY_MVCollectionViewCell.m
//  MooMusic
//
//  Created by 守护神 on 15/10/24.
//  Copyright © 2015年 wjy. All rights reserved.
//

#import "LTY_MVCollectionViewCell.h"

@implementation LTY_MVCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        bigPicImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        //bigPicImageView.backgroundColor = [UIColor greenColor];
        [self.contentView addSubview:bigPicImageView];
        
        smallPicImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        //smallPicImageView.backgroundColor = [UIColor redColor];
        [bigPicImageView addSubview:smallPicImageView];
        
        videoNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        videoNameLabel.font = [UIFont systemFontOfSize:14];
        //videoNameLabel.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:videoNameLabel];
        
        singerNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        singerNameLabel.textAlignment = NSTextAlignmentCenter;
        singerNameLabel.font = [UIFont systemFontOfSize:13];
        //singerNameLabel.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:singerNameLabel];
    }
    return self;
}

// item布局
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    bigPicImageView.frame = CGRectMake(0, 0, SCREENWIDTH / 2 - 40, 120);
    smallPicImageView.frame = CGRectMake(10, 10, 30, 20);
    videoNameLabel.frame = CGRectMake(0, bigPicImageView.frame.size.height, (SCREENWIDTH / 2 - 40), 25);
    singerNameLabel.frame = CGRectMake((SCREENWIDTH / 2 - 40) / 2, videoNameLabel.frame.origin.y + videoNameLabel.frame.size.height, (SCREENWIDTH / 2 - 40) / 2, 15);
}

- (void)setModel:(LTY_MVCollecTionModel *)model
{
    _model = model;
    [bigPicImageView sd_setImageWithURL:[NSURL URLWithString:model.picUrl] placeholderImage:[UIImage imageNamed:@"mv_big_cover_default.jpg"]];
    smallPicImageView.image = [UIImage imageNamed:@"mv_type_hight.png"];
    videoNameLabel.text = model.videoName;
    singerNameLabel.text = model.singerName;
}


@end
